home *** CD-ROM | disk | FTP | other *** search
- @ECHO OFF
- REM This is MOVE.BAT
- REM *** Replace the dummy directories in the next
- REM *** three lines with your own target directories
- REM *** Change just the part after the = sign!
- SET A=\ARCHIVE\
- SET B=\ARCHIVE\OLDFILES\
- SET C=\BACKUP\1991\
- FOR %%A IN (P p) DO IF %1!==%%A! GOTO LISTEM
- IF %2!==! GOTO OOPS1
- IF NOT EXIST %1 GOTO OOPS3
- SET TARG=%2
- FOR %%A IN (A a B b C c) DO IF %2!==%%A! GOTO %%A
- GOTO CHEK
- :A
- SET TARG=%A%
- GOTO CHEK
- :B
- SET TARG=%B%
- GOTO CHEK
- :C
- SET TARG=%C%
- :CHEK
- IF NOT EXIST %TARG%\%1 GOTO CHEK2
- ECHO %1 already exists in %TARG%
- ECHO Rename %1 and try again.
- GOTO END
- :CHEK2
- ECHO You're about to move %1 to %TARG%
- ECHO Press Y to do it, any other key to abort
- KEY
- IF ERRORLEVEL 89 IF NOT ERRORLEVEL 90 GOTO YES
- ECHO Aborting . . .
- GOTO END
- :YES
- XCOPY %1 %TARG% > NUL
- IF EXIST %TARG%\%1 GOTO WIPEIT
- ECHO Something's wrong. Aborting . . .
- GOTO END
- :WIPEIT
- DEL %1
- ECHO %1 now moved to %TARG%
- GOTO END
- :OOPS3
- ECHO %1 not found. Try another file.
- GOTO END
- :OOPS2
- ECHO %1 already exists in %TARG%
- GOTO END
- :LISTEM
- IF %A%%B%%C%!==! GOTO NOPRE
- ECHO Preset target directories:
- IF NOT %A%!==! ECHO A preset to %A%
- IF NOT %B%!==! ECHO B preset to %B%
- IF NOT %C%!==! ECHO C preset to %C%
- GOTO END
- :NOPRE
- ECHO No target directories preset
- GOTO END
- :OOPS1
- ECHO This will move files to from one
- ECHO directory to another. Enter:
- ECHO MOVE filename destination
- ECHO e.g. MOVE MYFILE \ARCHIVE\OLDFILES\
- ECHO ^
- ECHO (By adding the final \ to the directory
- ECHO name you can have MOVE create the
- ECHO directory if it doesn't already exist.)
- ECHO.
- ECHO Or you can preset up to three
- ECHO target directories and move files into
- ECHO them by using A, B, or C as targets.
- ECHO So if youÆve set B to be \ARCHIVE2:
- ECHO copy files into \ARCHIVE2 by typing:
- ECHO MOVE MYFILE B
- ECHO.
- ECHO You can see your preset target
- ECHO directories by typing MOVE P
- :END
- SET A=
- SET B=
- SET C=
- SET TARG=
-